package com.tjec.project.businessWorkbench.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tjec.common.constant.UserConstants;
import com.tjec.common.utils.SecurityUtils;
import com.tjec.common.utils.ServletUtils;
import com.tjec.framework.aspectj.lang.annotation.Log;
import com.tjec.framework.aspectj.lang.enums.BusinessType;
import com.tjec.framework.security.LoginUser;
import com.tjec.framework.security.service.TokenService;
import com.tjec.framework.web.controller.BaseController;
import com.tjec.framework.web.domain.AjaxResult;
import com.tjec.project.businessWorkbench.domain.BmsMenu;
import com.tjec.project.businessWorkbench.service.IBmsMenuService;
import com.tjec.project.system.domain.SysMenu;
import com.tjec.project.system.domain.SysUser;
import com.tjec.project.system.service.ISysMenuService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 业务主页-菜单信息
 * 
 * @author pangyognfeng
 */
@Api(value = "业务主页菜单管理", tags = {"业务主页菜单管理接口"})
@RestController
@RequestMapping("/business/menu")
public class BmsMenuController extends BaseController
{
    @Autowired
    private IBmsMenuService menuService;
    
    /**
     * 加载对应业务类别菜单列表树
     * bmsId 业务类别id
     */
    @ApiOperation("根据业务类别ID获取对应菜单列表")
    @GetMapping(value = "/bmsMenuTreeselect/{bmsId}")
    public AjaxResult bmsMenuTreeselect(@PathVariable("bmsId") String bmsId)
    {
         List<BmsMenu> menus = menuService.selectMenuTreeByBmsId(bmsId);
         return AjaxResult.success(menuService.buildMenus(menus));
    }
}